package com.example.demo.listen;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import com.example.demo.service.CacheService;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class RedisMsgPubSubListener {

	@Autowired
	private CacheService cacheService;

	public void onMessage(String message) {
		System.out.println("receives message :" + message);
		if ("findbyId".equals(message.split(":")[0])) {
			cacheService.refushFindbyId(message.split(":")[0], message.split(":")[1]);
		}

	}
}
